<?php
	//start the session
	session_start();

	$response;

	addAlbum();

	function addAlbum(){
		global $response;

		$userName = $_SESSION['userName'];
		$albumName = $_GET['albumName'];

		$response = array(
			'userName' => $userName,
			'albumName' => $albumName,
			'userDir' => false,
			'albumDir' => false,
			'success' => false
		);

		$userDir = "../users/".$userName;
		
		if(is_dir($userDir)){
			$response['userDir'] = true;
			if(mkdir($userDir.'/'.$albumName, 0777)){
				$response['albumDir'] = true;
				$response['success'] = true;
			}
		}

		echo json_encode($response);
	}
?>